package cn.fudong.bos.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.fudong.bos.dao.base.StandardRepository;
import cn.fudong.bos.domain.base.Standard;
import cn.fudong.bos.service.base.StandardService;

@Service
@Transactional
public class StandardServiceImpl implements StandardService {

	// 注入DAO
	@Autowired
	private StandardRepository standardRepository;
	
	
	//保存操作
	@Override
	@CacheEvict(value="standard",allEntries=true)
	public void save(Standard standard) {
		standardRepository.save(standard);
		
	}
	//分页查询
	@Override
	@Cacheable(value="standard",key="#pageable.pageNumber+'_'+#pageable.pageSize")
	public Page<Standard> findPageData(Pageable pageable) {
		Page<Standard> pageData = standardRepository.findAll(pageable);
		return pageData;
	}
	//查询全部收派标准列表
	@Override
	@Cacheable("standard")
	public List<Standard> findAll() {
		return standardRepository.findAll();
	}

}
